package com.modificial.shiro.system.dao;

import com.modificial.shiro.mapper.BaseMapper;
import com.modificial.shiro.system.domain.SysRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * @author modificial
 * @date 2018/8/4 0004
 * @company modificial_org
 * @description 角色操作
 */
@Repository
public interface RoleDao extends BaseMapper<SysRole> {
    /**
     * 禁用或启用用户
     * @param roleId 角色id
     * @param isEnable 禁用或启用
     * @return
     */
    @Update("update sys_role set is_enable=#{isEnable} where role_id=#{roleId}")
    int disableRole(@Param("roleId") String roleId,@Param("isEnable") Integer isEnable);

    /**
     * 更新角色信息
     * @param sysRole
     * @return
     */
    @Update("update sys_role set role_name=#{roleName},description=#{description},update_time=now(),sort=#{sort} where role_id=#{roleId}")
    int updateRole(SysRole sysRole);
}
